home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / kernel / object.c < prev    next >
C/C++ Source or Header  |  1997-04-16  |  5KB  |  242 lines

  1.  
  2.  
  3. /*  Copyright (c) 1993-1996 Algorithms Corporation  */
  4. /*  All rights reserved.  */
  5.  
  6.  
  7.  
  8.  
  9. /*  This file automatically generated by dpp - do not edit  */
  10.  
  11. #define    DPP_STRATEGY    2
  12. #define    DPP_FASTWIDE    0
  13.  
  14.  
  15.  
  16. #line 13 "object.d"
  17. #include <math.h> 
  18.  
  19. #define    CLASS    Object_c
  20. #define    ivType    Object_iv_t
  21.  
  22. #include "generics.h"
  23.  
  24. object    Object_c;
  25.  
  26. #include "object.iv"
  27.  
  28.  
  29.  
  30. #line 21 "object.d"
  31. imeth objrtn Object_im_gError(object self, char *msg)
  32.     if (File_c) 
  33.         gPuts(stderrStream, msg); 
  34.     else { 
  35.         if (IsObj((object) msg)) 
  36.             msg = gStringValue((object) msg); 
  37.         fprintf(stderr, "%s", msg); 
  38.     } 
  39.     exit(1); 
  40.     return self; 
  41.  
  42. ivmeth objrtn Object_ivm_vError(object self, va_list _rest_)
  43. { char * fmt = va_arg(_rest_, char *);
  44.     char buf[512]; 
  45.     MAKE_REST(fmt); 
  46.  
  47.     vsprintf(buf, fmt, _rest_); 
  48.     return gError(self, buf); 
  49.  
  50. #line 54 "object.c"
  51.  
  52. static    objrtn    Object_ifm_vError(object self, ...)
  53. {
  54.     va_list    _rest_;
  55.     va_start(_rest_, self);
  56.     return Object_ivm_vError(self, _rest_);
  57. }
  58.  
  59.  
  60.  
  61. #line 43 "object.d"
  62. imeth objrtn Object_im_gSubclassResponsibility(object self, char *meth)
  63.     char buf[100]; 
  64.     object aCls; 
  65.  
  66.     aCls = IsaClass(self) ? self : ClassOf(self); 
  67.     sprintf(buf, "Method %s should be implemented by a subclass of %s\n", 
  68.         meth, gName(aCls)); 
  69.     return gError(self, buf); 
  70.  
  71. imeth objrtn Object_im_gShouldNotImplement(object self, char *meth)
  72.     char buf[100]; 
  73.  
  74.     if (IsaClass(self)) 
  75.         sprintf(buf, "Method %s is not appropriate for the %s class\n", 
  76.         meth, gName(self)); 
  77.     else 
  78.         sprintf(buf, "Method %s is not appropriate for instances of %s\n", 
  79.         meth, gName(ClassOf(self))); 
  80.     return gError(self, buf); 
  81.  
  82. #ifndef NOCLASSLIB 
  83.  
  84. imeth objrtn Object_im_gStringRep(object self)
  85.     object s, t; 
  86.  
  87.     s = vSprintf(String, "%s:<%8.8lx> [ ", gName(ClassOf(self)), self); 
  88.     t = gStringRepValue(self); 
  89.     vBuild(s, NULL, t, " ]\n", NULL); 
  90.     gDispose(t); 
  91.     return s; 
  92.  
  93. imeth objrtn Object_im_gStringRepValue(object self)
  94.     return vSprintf(String, "%s:<%8.8lx>", gName(ClassOf(self)), self); 
  95.  
  96. imeth objrtn Object_im_gPrint(object self, object stream)
  97.     object t; 
  98.  
  99.     ChkArg(stream, 2); 
  100.     t = gStringRep(self); 
  101.     gPuts(stream, (char *) t); 
  102.     gDispose(t); 
  103.     return self; 
  104.  
  105. imeth objrtn Object_im_gPrintValue(object self, object stream)
  106.     object t; 
  107.  
  108.     ChkArg(stream, 2); 
  109.     t = gStringRepValue(self); 
  110.     gPuts(stream, (char *) t); 
  111.     gDispose(t); 
  112.     return self; 
  113.  
  114. #endif 
  115.  
  116. imeth int Object_im_gHash(object self)
  117.     double t; 
  118.  
  119.     t = .6125423371 * (double)(unsigned long) self; 
  120.     t = t < 0.0 ? -t : t; 
  121.     return (int) (BIG_INT * (t - floor(t))); 
  122.  
  123. imeth int Object_im_gCompare(object self, object obj2)
  124.     if (EQ(self, obj2)) 
  125.         return 0; 
  126.     ChkArg(obj2, 2); 
  127.     if ((unsigned long) self < (unsigned long) obj2) 
  128.         return -1; 
  129.     else 
  130.         return 1; 
  131.  
  132. imeth int Object_im_gIsKindOf(object self, object aCls)
  133.     static gIsKindOf_t class_IsKindOf = NULL; 
  134.  
  135.  
  136.  
  137.     if (!class_IsKindOf) 
  138.         class_IsKindOf = imcPointer(Behavior, gIsKindOf); 
  139.     return class_IsKindOf(ClassOf(self), aCls); 
  140.  
  141. imeth objrtn Object_im_gInit(object self)
  142.     return self; 
  143.  
  144. objrtn Object_initialize(void) 
  145.     static int done = 0; 
  146.  
  147.  
  148.  
  149.  
  150.     if (done) 
  151.         return Object_c; 
  152.  
  153.     done = 1; 
  154.  
  155.  
  156.  
  157.     iMethodFor(Object, gError, Object_im_gError); 
  158. #if DPP_STRATEGY == 1 
  159.     ivMethodFor(Object, vError, Object_ivm_vError, Object_ivm_vError); 
  160. #else 
  161.     ivMethodFor(Object, vError, Object_ivm_vError, Object_ifm_vError); 
  162. #endif 
  163.     iMethodFor(Object, gSubclassResponsibility, Object_im_gSubclassResponsibility); 
  164.     iMethodFor(Object, gShouldNotImplement, Object_im_gShouldNotImplement); 
  165.     iMethodFor(Object, gHash, Object_im_gHash); 
  166.     iMethodFor(Object, gCompare, Object_im_gCompare); 
  167.     iMethodFor(Object, gIsKindOf, Object_im_gIsKindOf); 
  168.     iMethodFor(Object, gInit, Object_im_gInit); 
  169.  
  170. #ifndef NOCLASSLIB 
  171.     iMethodFor(Object, gStringRep, Object_im_gStringRep); 
  172.     iMethodFor(Object, gStringRepValue, Object_im_gStringRepValue); 
  173.     iMethodFor(Object, gPrint, Object_im_gPrint); 
  174.     iMethodFor(Object, gPrintValue, Object_im_gPrintValue); 
  175. #endif 
  176.     return Object_c; 
  177.  
  178. #if 0 
  179.  
  180. imeth objrtn Object_im_gDispose(object self)
  181.  
  182. #line 183 "object.d"
  183. {} 
  184.  
  185.  
  186. #line 184 "object.d"
  187. imeth int Object_im_gEqual(object self, object obj2)
  188.  
  189. #line 184 "object.d"
  190. {} 
  191.  
  192.  
  193. #line 185 "object.d"
  194. imeth objrtn Object_im_gCopy(object self)
  195.  
  196. #line 185 "object.d"
  197. {} 
  198.  
  199.  
  200. #line 186 "object.d"
  201. imeth int Object_im_gSize(object self)
  202.  
  203. #line 186 "object.d"
  204. {} 
  205.  
  206.  
  207. #line 187 "object.d"
  208. imeth int Object_im_gBasicSize(object self)
  209.  
  210. #line 187 "object.d"
  211. {} 
  212.  
  213.  
  214.  
  215.  
  216. #endif 
  217.